package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.EquipmentDao;
import cn.topevery.garden.entity.po.Equipment;
import cn.topevery.garden.entity.query.EquipmentQuery;
import cn.topevery.garden.entity.vo.EquipmentVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 
 *
 * @author code-generate
 * @date 2022-02-23
 */
@Service
public class EquipmentLogic extends BaseLogic<Equipment> {
    @Autowired
    EquipmentDao equipmentDao;

    @Override
    public BaseEntityDao<Equipment, Integer> getDao() {
        return equipmentDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<EquipmentVO> listPage(EquipmentQuery query) {
        return equipmentDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        equipmentDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param equipment 实体
     */
    public void saveOrUpdate(String userId, Equipment equipment){
        equipmentDao.saveOrUpdate(userId,equipment);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public Equipment getEntityByColumn(String key, String value) {
        return equipmentDao.getEntityByColumn(key, value);
    }

    public void checkList(List<Integer> idList, Integer checkStatus) {
        equipmentDao.checkList(idList, checkStatus);
    }

    public DataPager<EquipmentVO> getEquipmentListByPointId(EquipmentQuery query) {
        return equipmentDao.getEquipmentListByPointId(query);
    }

    public void setEquipmentStatus(List<Integer> idList, Integer callStatus) {
        equipmentDao.setEquipmentStatus(idList, callStatus);
    }

}
